<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <title></title>
 <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/btn.css">
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/validate.js"></script>
<script type="text/javascript">
wearSizeValidate=function(){
	var val = $("input[name='wearSize']").val();
	var reg = new RegExp("，","g");
	val = val.replace(reg,",");
	$("input[name='wearSize']").val(val);
	
	var strs = val.split(",");
	var flag = true;
	for(var i=0;i<strs.length;i++){
		var str = strs[i];
		var re = /^[0-9]\d*$/;
		if(!re.test(str)){
			alert("格式不正确！");
			$("input[name='wearSize']").focus();
			flag = false;
			return;
		}
	}
	return flag;
};
beforeSubmit=function(){
	if(wearSizeValidate()){
		validate();
	}
};
</script>
  </head>
 
  <body>
  	<span class="path">&gt;库存列表</span>
  	<c:if test="${not empty childWear.id }">
  		<span class="path">修改</span><br><br>
  	</c:if>
  	<c:if test="${empty childWear.id }">
	  	<span class="path">新增</span><br><br>
  	</c:if>
  	<form name="form" action="${pageContext.request.contextPath }/childWear/save" method="post">
  		<div class="btn add"><a href="#" onclick="beforeSubmit()">保存</a></div><br><br>
    	<input type="hidden" name="id" value="${childWear.id }" />
		<table width="500px" style="border: 1px;">
			<tr>
				<td>衣服编码</td>
				<td><input type="text" name="wearCode" value="${childWear.wearCode }"/></td>
			</tr>
			<tr>
				<td>衣服类别</td>
				<td><input type="text" name="wearType" value="${childWear.wearType }"/></td>
			</tr>
			<c:if test="${empty childWear.id }">
				<tr>
					<td>码数</td>
					<td><input type="text" name="wearSize" value="${childWear.wearSize }"/>&nbsp;&nbsp;<span style="color: red;">多个码数用逗号分开，如9,10,11</span></td>
				</tr>
			</c:if>
			<tr>
				<td>进价</td>
				<td><input type="text" class="double" name="inPrice" value="${childWear.inPrice }"/></td>
			</tr>
			<tr>
				<td>售价</td>
				<td><input type="text" class="double" name="outPrice" value="${childWear.outPrice }"/></td>
			</tr>
			<tr>
				<td>库存</td>
				<td><input type="text" class="int" name="inventory" value="${childWear.inventory }"/></td>
			</tr>
			<tr>
				<td>已售</td>
				<td><input type="text" class="int" name="sales" value="${childWear.sales }"/></td>
			</tr>
		</table>
	</form>
  </body>
</html>
